package com.technique.api.dao.mapper;

import com.technique.api.dao.entity.Requirement;
import com.technique.api.dao.entity.RequirementExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface RequirementMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @SelectProvider(type=RequirementSqlProvider.class, method="countByExample")
    int countByExample(RequirementExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @DeleteProvider(type=RequirementSqlProvider.class, method="deleteByExample")
    int deleteByExample(RequirementExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @Delete({
        "delete from requirement",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @Insert({
        "insert into requirement (uid, publish_date, ",
        "target_places, user_count, ",
        "plan_start_date, custom_requirement, ",
        "plan_trip_days, budget, ",
        "ext)",
        "values (#{uid,jdbcType=BIGINT}, #{publishDate,jdbcType=TIMESTAMP}, ",
        "#{targetPlaces,jdbcType=VARCHAR}, #{userCount,jdbcType=INTEGER}, ",
        "#{planStartDate,jdbcType=TIMESTAMP}, #{customRequirement,jdbcType=VARCHAR}, ",
        "#{planTripDays,jdbcType=INTEGER}, #{budget,jdbcType=INTEGER}, ",
        "#{ext,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Requirement record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @InsertProvider(type=RequirementSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(Requirement record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @SelectProvider(type=RequirementSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="publish_date", property="publishDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="target_places", property="targetPlaces", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_count", property="userCount", jdbcType=JdbcType.INTEGER),
        @Result(column="plan_start_date", property="planStartDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="custom_requirement", property="customRequirement", jdbcType=JdbcType.VARCHAR),
        @Result(column="plan_trip_days", property="planTripDays", jdbcType=JdbcType.INTEGER),
        @Result(column="budget", property="budget", jdbcType=JdbcType.INTEGER),
        @Result(column="ext", property="ext", jdbcType=JdbcType.VARCHAR)
    })
    List<Requirement> selectByExample(RequirementExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, uid, publish_date, target_places, user_count, plan_start_date, custom_requirement, ",
        "plan_trip_days, budget, ext",
        "from requirement",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="publish_date", property="publishDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="target_places", property="targetPlaces", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_count", property="userCount", jdbcType=JdbcType.INTEGER),
        @Result(column="plan_start_date", property="planStartDate", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="custom_requirement", property="customRequirement", jdbcType=JdbcType.VARCHAR),
        @Result(column="plan_trip_days", property="planTripDays", jdbcType=JdbcType.INTEGER),
        @Result(column="budget", property="budget", jdbcType=JdbcType.INTEGER),
        @Result(column="ext", property="ext", jdbcType=JdbcType.VARCHAR)
    })
    Requirement selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @UpdateProvider(type=RequirementSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Requirement record, @Param("example") RequirementExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @UpdateProvider(type=RequirementSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Requirement record, @Param("example") RequirementExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @UpdateProvider(type=RequirementSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Requirement record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table requirement
     *
     * @mbggenerated
     */
    @Update({
        "update requirement",
        "set uid = #{uid,jdbcType=BIGINT},",
          "publish_date = #{publishDate,jdbcType=TIMESTAMP},",
          "target_places = #{targetPlaces,jdbcType=VARCHAR},",
          "user_count = #{userCount,jdbcType=INTEGER},",
          "plan_start_date = #{planStartDate,jdbcType=TIMESTAMP},",
          "custom_requirement = #{customRequirement,jdbcType=VARCHAR},",
          "plan_trip_days = #{planTripDays,jdbcType=INTEGER},",
          "budget = #{budget,jdbcType=INTEGER},",
          "ext = #{ext,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Requirement record);
}